package com.dome.backtemplate.config.filter;


import com.dome.backtemplate.constant.SystemConstant;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description TODO
 * @Author 小乌龟
 * @Date 2023/4/8 10:07
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    /**
     * 注册自定义拦截器
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserInterceptor())
                //controller 路径开始配置
                .addPathPatterns("/**")
                //开放登录路径
                .excludePathPatterns(SystemConstant.LOGIN_PATH, SystemConstant.BACK_LOGIN_PATH);
    }

}
